// pages/test/test.js
Page({ 
  // data: {  
  // },

  // click(){
  //   wx.previewImage({
  //     current: 'https://img1.doubanio.com/view/celebrity/s_ratio_celebrity/public/p67.webp',
  //     urls: ["https://img1.doubanio.com/view/celebrity/s_ratio_celebrity/public/p67.webp"]
  //   })
  // }
  onLoad(){
        var image=wx.getStorageSync('image');
        if(image){
          var imgUrl=image.imgUrl[0];
          var isEmpty=image.isEmpty;
          this.setData({
            imgUrl,
            isEmpty
          })
        }
  },
  data:{
    isEmpty:true
  },
  click(){
    wx.chooseImage({
      count: 9,	// 默认为9
      sizeType: ['original', 'compressed'],	// 指定原图或者压缩图
      sourceType: ['album', 'camera'],	// 指定图片来源
      success:res=>{
        var tempFilePaths = res.tempFilePaths;
        wx.setStorageSync('image',{
           imgUrl:tempFilePaths,
            isEmpty:false
        })
        var image=wx.getStorageSync('image');
        var imgUrl=image.imgUrl[0];
        var isEmpty=image.isEmpty;
        this.setData({
         isEmpty:isEmpty,
         imgUrl
        })    
      }
    })
  }
})